/*!
 * Copyright 2019 WeBank
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

@import '../../../assets/styles/variables.scss';
$toolbarWidth: 40px;
.workbench {
    .ivu-tabs.ivu-tabs-card {
        border-top: $border-width-base $border-style-base #dcdee2;
        .ivu-tabs-bar .ivu-tabs-tab {
            margin-right: 0px;
            margin-left: -1px;
            border-radius: 0;
            vertical-align: top;
            border-top: 0;
            padding: 5px 16px;
            border-color: #dcdee2!important;
            &.ivu-tabs-tab-active {
                border-top: 2px solid $primary-color!important;
            }
        }
    }
}

.workbench-tabs {
    position: $relative;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    .workbench-tab-wrapper {
        display: flex;
        border-top: $border-width-base $border-style-base #dcdcdc;
        border-bottom: $border-width-base $border-style-base #dcdcdc;
        &.full-screen {
            position: fixed;
            left: 0;
            right: 0;
            top: 0;
            height: 33px;
            z-index: 1200;
        }
        .workbench-tab {
            flex: 1;
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            justify-content: flex-start;
            align-items: flex-start;
            height: 32px;
            background-color: $body-background;
            width: calc(100% - 45px);
            overflow: hidden;
            .workbench-tab-item {
                position: $relative;
                height: 32px;
                line-height: 32px;
                background-color: $background-color-base;
                color: $title-color;
                cursor: pointer;
                min-width: 100px;
                max-width: 200px;
                overflow: hidden;
                margin-right: 2px;
                border: 1px solid #eee;
                &.active {
                    margin-top: 1px;
                    height: 31px;
                    background-color: $body-background;
                    color: $primary-color;
                    border-radius: 4px 4px 0 0;
                    border: 1px solid $border-color-base ;
                    border-bottom: 2px solid $primary-color;
                    line-height: 30px;
                }
            }
        }
        .workbench-tab-control {
            flex: 0 0 45px;
            text-align: right;
            background-color: $body-background;
            border-left: $border-width-base $border-style-base $border-color-split;
            .ivu-icon {
                font-size: $font-size-base;
                margin-top: 8px;
                margin-right: 2px;
                cursor: pointer;
                &:hover {
                    color: $primary-color;
                }
            }
        }
        .workbench-tab-button {
            flex: 0 0 30px;
            text-align: center;
            background-color: $body-background;
            .ivu-icon {
                font-size: $font-size-base;
                margin-top: 8px;
                cursor: pointer;
            }
        }
    }
    .workbench-container {
        height: calc(100% - 32px);
        &.node {
            height: 100%;
        }
        .workbench-log-view {
            height: 100%;
            .log-tools {
                height: 36px;
                line-height: 36px;
                padding-left: 10px;
                background: $background-color-base;
                position: $relative;
                border-bottom: 2px solid $border-color-base;
                overflow: hidden;
                margin-bottom: -2px;
                .log-tools-control {
                    display: inline-block;
                    position: $absolute;
                    top: 2px;
                    .log-tabs {
                        display: inline-block;
                        position: $absolute;
                    }
                    .log-search {
                        width: 100px;
                        position: $absolute;
                        left: 350px;
                        top: 5px;
                        font-size: $font-size-small;
                    }
                    .err-badge {
                        background: $error-color !important;
                    }
                    .warn-badge {
                        background: $yellow-color !important;
                    }
                }
            }
        }
        .workbench-history {
            height: 100%;
            .workbench-history-table {
                border: none;
                .ivu-table th {
                    background-color: $table-thead-blue-bg;
                    color: $body-background;
                }
            }
            .workbench-history-page {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 30px;
                margin-top: 5px;
            }
            .history-failed {
                color: $error-color;
            }
            .history-control {
                .ivu-table-cell {
                    padding: 0;
                }
            }
        }
        .progress{
            background: $body-background;
            height: 100%;
            .ivu-table-wrapper{
                border: none;
                height:100%;
                .ivu-table th {
                    background-color: $table-thead-blue-bg;
                    color: $body-background;
                }
            }
        }
        .progress-wrap{
            position: $relative;
            width:100%;
            height: 10px;
            background: $background-color-select-hover;
            border-radius: 100px;
        }
        .progress-item{
            position:absolute;
            top: 0;
            left: 0;
            height: 100%;
            transition: all $transition-time linear;
            border-radius: 10px;

        }

        .progress-success{
            background:$success-color;
        }


        .progress-failed{
            background: $error-color;
        }
        .progress-waiting{
            background: $primary-color;
        }

        .progress-waiting:after{
            content: '';
            opacity: 0;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: $body-background;
            border-radius: 10px;
            animation: ivu-progress-active 2s $ease-in-out infinite;
        }
        .progress-text{
            font-size: $font-size-small;
            margin-right: 10px;
        }
        .total-progress{
            padding: 6px 0;
            color: $title-color;
            .title{
                text-align: center;
            }
        }
        .progress-costtime {
            color: $success-color;
        }
        @keyframes ivu-progress-active {
            0% {
                opacity: .3;
                width: 0;
            }
            100% {
                opacity: 0;
                width: 100%;
            }
        }

        .we-steps {
            .we-steps-row-first {
                width: 100%;
                padding: 20px 0 10px;
                display: flex;
                align-items: center;
                .we-steps-title {
                    text-align: center;
                    color: $title-color;
                }
                .we-steps-child-col {
                    height: 50px;
                    display: inline-flex;
                    justify-content: flex-start;
                    align-items: center;
                    .we-steps-child {
                        display: flex;
                        align-items: center;
                        .we-steps-child-wrapper {
                            display: inline-flex;
                            flex-direction: column;
                            align-items: center;
                            padding: 0 8px;
                            .we-steps-circle {
                                width: 20px;
                                height: 20px;
                                border-radius: 10px;
                                display: inline-block;
                                background: $subsidiary-color;
                                text-align: center;
                                .we-steps-circle-checkmark {
                                    color: $body-background;
                                }
                                &.loading {
                                    background: orange;
                                }
                                &.completed {
                                    background: #67c23a ;
                                }
                                &.error {
                                    background: #ed4014;
                                }
                                &.cancelled {
                                    background: #ddd
                                }
                            }
                            .we-steps-label {
                                display: inline-block;
                                margin-top: 6px;
                                &.ellipsis {
                                    font-weight: bold;
                                    font-size: 19px;
                                    display: inline-block;
                                    line-height: 17px;
                                    height: 17px;
                                }
                                &.loading {
                                    color: orange;
                                }
                                &.completed {
                                    color: #67c23a ;
                                }
                                &.error {
                                    color: #ed4014;
                                }
                                &.cancelled {
                                    color: $pink-color
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

.workbench-title {
    position: $relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px;
    padding-right: 30px;
    font-size: $font-size-base;
    .workbench-title-logo {
        font-size: 16px;
        margin-right: 4px;
    }
    .workbench-title-text {
        display: block;
        flex: 1;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .workbench-title-button {
        position: $absolute;
        right: 10px;
        top: 0;
        font-size: $font-size-base;
        .fi-radio-on2 {
            font-size: $font-size-small;
        }
    }
}

.workbench-body {
    height: 100%;
    .table-detail {
        height: 100%;
        background: $table-thead-bg;
        padding: 16px 10px 10px 16px;
        .table-detail-tabs {
            height: 100%;
            .ivu-tabs-bar {
                margin-bottom: 10px;
            }
            .ivu-tabs-content {
                height: 100%;
            }
            .basic-card {
                margin-bottom: 10px;
                height: calc(100% - 52px);
                overflow: hidden;
                .basic-card-item {
                    display: inline-flex;
                    width: 50%;
                    height: 36px;
                    padding-left: 10px;
                    align-items: center;
                    &.comment {
                        height: 42px;
                        align-items: start;
                    }
                    .basic-card-item-title {
                        display: inline-block;
                        width: 100px;
                        font-weight: bold;
                    }
                    .basic-card-item-value {
                        display: inline-block;
                        width: calc(100% - 104px);
                        overflow: hidden;
                        &.comment {
                            overflow-y: auto;
                            height: 100%;
                        }
                    }
                }
            }
            .field-table {
                height: calc(100% - 52px);
                overflow: hidden;
                .field-table-header, .field-table-body {
                    display: flex;
                    border: 1px solid #dcdee2;
                    height: 46px;
                    line-height: 46px;
                }
                .field-table-header {
                    background-color: #5e9de0;
                    color: #fff;
                    font-weight: bold;
                    margin-top: 10px;
                    border: none;
                }

                .field-table-body {
                    border-bottom: none;
                    background: #fff;
                }

                .field-table-item {
                    padding: 0 10px;
                    display: inline-block;
                    height: 100%;
                    text-align: center;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
                .field-table-index {
                    width: 5%;
                    min-width: 50px;
                }

                .field-table-name {
                    width: 15%;
                }
                .field-table-type {
                    width: 10%;
                    min-width: 70px;
                }
                .field-table-alias {
                    width: 15%;
                }
                .field-table-primary {
                    width: 10%;
                    min-width: 70px;
                }
                .field-table-part {
                    width: 10%;
                    min-width: 70px;
                }
                .field-table-rule {
                    width: 10%;
                    min-width: 70px;
                }
                .field-table-comment {
                    width: 25%;
                }
            }
            .statistics {
                height: calc(100% - 52px);
                overflow: hidden;
                .statistics-card {
                    height: 100%;
                    .ivu-card-body {
                        height: calc(100% - 52px);
                    }
                    .statistics-card-item {
                        display: inline-flex;
                        width: 100%;
                        height: 36px;
                        line-height: 36px;
                        padding-left: 10px;
                        align-items: center;
                        .statistics-card-item-title {
                            display: inline-block;
                            width: 100px;
                            font-weight: bold;
                        }
                        .statistics-card-item-value {
                            display: inline-block;
                            width: calc(100% - 104px);
                            overflow: hidden;
                        }
                    }
                    .statistics-card-label {
                        margin-left: 4px;
                    }
                    .statistics-card-tree {
                        overflow-y: auto;
                        height: 100%;
                        margin-left: 20px;
                    }
                }
            }
        }
    }
    .create-table-view {
        height: 100%;
        overflow-y: auto;
        .create-table-view-button-group {
            padding: 20px;
            text-align: right;
            button {
                margin-right: 10px;
            }
        }
        .create-table-step-first {
            .basic-card {
                .basic-card-form {
                    .ivu-form-item {
                        display: inline-block;
                        width: 50%;
                    }
                }
            }
            .create-table-btn-group {
                float: right;
                margin-top: 10px;
                button {
                    margin-right: 20px;
                }
            }
        }
        .create-table-second-step {
            .data-source {
                display: block;
                background: #fff;
                border-radius: 4px;
                font-size: 14px;
                position: relative;
                -webkit-transition: all .2s ease-in-out;
                transition: all .2s ease-in-out;
                padding: 14px 16px;
                line-height: 1;
                &:hover {
                    -webkit-box-shadow: 0 1px 6px rgba(0,0,0,.2);
                    box-shadow: 0 1px 6px rgba(0,0,0,.2);
                    border-color: #eee;
                }
                .data-source-item-wrap {
                    display: inline-block;
                    .data-source-title {
                        display: inline-block;
                        height: 20px;
                        line-height: 20px;
                        font-size: 14px;
                        color: #17233d;
                        font-weight: 700;
                    }
                    .data-source-type {
                        margin-left: 20px;
                        width: 200px;
                    }
                }
            }
            .create-table {
                height: 50%;
                .field-list {
                    .field-list-title {
                        width: 1100px;
                        height: 38px;
                        background-color: #5e9de0;
                        color: #fff;
                        font-weight: bold;
                        border: none;
                        border-radius: 4px 4px 0 0 ;
                        .field-list-title-index {
                            width: 50px;
                            display: inline-block;
                            text-align: center;
                        }
                        .field-list-title-item {
                            display: inline-flex;
                            margin: 0 6px;
                            text-align: center;
                            justify-content: center;
                            align-items: center;
                            height: 100%;
                            .field-list-title-item-require {
                                margin-right: 2px;
                            }
                        }
                        .field-list-title-action {
                            width: 60px;
                            display: inline-block;
                            text-align: center;
                        }
                    }
                    .field-list-content {
                        width: 1100px;
                        .field-list-content-item {
                            padding: 12px 0 0;
                            border: 1px solid #dcdee2;
                            border-top: none;
                            .field-list-content-item-index {
                                width: 50px;
                                display: inline-block;
                                text-align: center;
                                height: 54px;
                                line-height: 36px;
                            }
                            .field-list-content-item-item {
                                margin: 0 6px 20px;
                                display: inline-block;
                                text-align: center;
                            }
                            .field-list-content-action {
                                width: 60px;
                                display: inline-block;
                                text-align: center;
                                margin-top: 6px;
                            }
                        }
                    }
                }
            }
        }
    }
    .import-table {
        .import-table-hive {
            .import-table-hive-item {
                padding: 10px 0 10px 20px;
                .import-table-hive-item-title {
                    display: inline-block;
                    font-weight: bold;
                    margin-right: 10px;
                }
                .import-table-hive-item-select {
                    width: 300px;
                }
            }
        }
    }
    .we-new-list-container {
        height: 100%;
    }
    .we-new-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        height: 100%;
        overflow-y: auto;
        .business-type-script {
            position: $relative;
            display: flex;
            flex-direction: column;
            width: 240px;
            height: 240px;
            padding: 0px 10px;
            margin: 14px;
            overflow: hidden;
            transition: all $transition-time ease;
            background: $background-color-base;
            border: $border-width-base $border-style-base $border-color-base;
            .we-new-list-header {
                flex: 0 0 40px;
                line-height: 40px;
                font-size: $font-size-small;
            }
            .we-new-list-header-type {
                width: 68px;
                height: 28px;
                padding: 0 5px;
                margin-bottom: 10px;
                margin-right: 4px;
                line-height: 25px;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
                cursor: pointer;
                display: inline-block;
                background: $background-color-base;
                border: $border-width-base $border-style-base $border-color-split;
                &:hover {
                    color: #00c1de;
                    background: #e5f8fb;
                    border: $border-width-base $border-style-base #00c1de;
                }
            }
            .we-new-list-content {
                margin-bottom: 10px;
            }
            .business-type-script-name {
                color: $subsidiary-color;
                display: inline-block;
                width: 100px;
                text-align: right;
                line-height: 26px;
            }
            .business-type-script-value {
                color: $subsidiary-color;
                display: inline-block;
                line-height: 26px;
            }
            .we-new-list-add {
                font-size: 100px;
                display: flex;
                justify-content: center;
                height: 180px;
                align-items: center;
                cursor: pointer;
            }
            .we-new-list-footer {
                flex: 0 0 34px;
                line-height: 35px;
                position: $absolute;
                bottom: 0;
            }
            .we-new-list-footer-open {
                color: #00c1de;
                cursor: pointer;
            }
        }
    }
    .workbench-body-navbar {
        padding: 0 4px;
        border-bottom: $border-width-base $border-style-base $border-color-base;
        height: 32px;
        line-height: 32px;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
    }
    .workbench-body-navbar-group {
        display: flex;
    }
    .workbench-body-navbar-item {
        margin: 0 16px;
        cursor: pointer;
        color: rgba($text-color, 0.8);
        &.disabled {
            color: rgba($text-color, 0.5);
        }
        &:hover {
            color: $link-active-color;
            &.disabled {
                color: rgba($text-color, 0.5);
            }
        }
        .ivu-icon {
            font-size: 16px;
        }
        .navbar-item-name {
            margin-left: 1px;
        }
    }
    .we-editor {
        height: calc(100% - 32px);
    }
    .tc {
        text-align: center;
    }
}

.log-panel {
    border-top: $border-width-base $border-style-base $border-color-base;
    background-color: $background-color-base;
    .workbench-tab-wrapper{
        border-top: none;
    }
    .workbench-tabs .workbench-tab .workbench-tab-item {
        text-align: center;
        border-top: none;
        background: $body-background;
        &.active {
            border-bottom: $border-width-base $border-style-base $border-color-base;
            background: $background-color-base;
            color: $title-color;
        }
    }
}

.editor-panel {
    .new-sidebar-spin {
        background-color: rgba(255, 255, 255, .1);
    }
    .editor {
        height: 100%;
        .editor-content {
            height: 100%;
            display: flex;
            .editor-setting {
                width: 400px;
                background: $background-color-base;
                border-left: $border-width-base $border-style-base $border-color-base;
                overflow-y: auto;
                position: $absolute;
                top: 32px;
                right: 0;
                bottom: 0;
                .editor-setting-header {
                    border-bottom: $border-width-base $border-style-base #e8eaec;
                    padding: 10px 16px;
                    line-height: 1;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    span {
                        color: #17233d;
                        font-size: $font-size-base;
                    }
                    i {
                        font-size: 26px;
                        color: #999;
                        cursor: pointer;
                    }
                }
                .setting-title-wrap {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    height: 30px;
                    padding-right: 7px;
                    .setting-title {
                        display: inline-block;
                    }
                    .setting-icon-add {
                        cursor: pointer;
                    }
                }
                .runtime-args {
                    padding: 10px 10px 2px;;
                    margin: 10px;
                    background: $menu-dark-subsidiary-color;
                    border-radius: $border-radius-small;
                }
            }
        }
    }
}

.we-result-view {
    position: $relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding-left: $toolbarWidth;
    background: $body-background;
    .text-result-div {
        overflow: auto;
        padding: 10px;
    }
    .table-box {
        overflow: auto;
    }
    .result-normal-table {
        border: none;
        border-right: $border-width-base $border-style-base $border-color-base;
        overflow: auto;
        min-width: 100%;
        .ivu-table {
            min-width: 100%;
            .is-null {
                color: $error-color;
                font-style: italic;
            }
        }
    }
    .html-result-div {
        overflow-y: auto;
    }
    .we-page-container {
        position: $absolute;
        bottom: 0;
        left: 40px;
        width: 100%;
        height: 42px;
        display: flex;
        align-items: center;
        .page {
            left: 50%;
            position: $relative;
            display: inline-block;
        }
        .set {
            position: $absolute;
            left: 42px;
            top: 15px;
            width: 150px;
        }
    }

    .ivu-table th{
        background-color: $table-thead-blue-bg;
        color: $body-background;
    }
}

.we-toolbar {
    width: $toolbarWidth;
    height: 100%;
    position: $fixed;
    margin-left: -$toolbarWidth;
    padding-top: 10px;
    background: $body-background;
    border-right: $border-width-base $border-style-base $border-color-base;
    li {
        padding-bottom: 20px;
        text-align: center;
        cursor: pointer;
    }
    span {
        display: block;
        line-height: 24px
    }
    .v-toolbar-icon {
        width: 40px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
}
.results-export {
    .results-export-content-help {
        cursor: pointer;
        font-size: $font-size-base;
    }
}
.table-row {
    .table-row-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-right: 26px;
        padding-left: 6px;
        .table-row-input {
            width: 200px;
            float: right;
        }
    }
    .table-row-table {
        .ivu-table th {
            background-color: $table-thead-blue-bg;
            color: $body-background;
        }
        .ivu-table .is-null {
            color: $error-color;
            font-style: italic;
        }
    }
}

.we-poptip {
    padding: 12px;
    line-height: 28px;
    .confirm {
        margin-top: 10px;
    }
    .title {
        margin: 10px 0;
        text-align: center;
    }
}

.ivu-modal {
    .modal-title {
        font-size: 16px;
        .ivu-icon {
            font-size: 20px;
            color: $warning-color;
            margin-right: 10px;
        }
    }
    .modal-content {
        padding: 10px 20px;
        font-size: $font-size-base;
    }
}

.we-center-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    .ivu-modal {
        top: 50%;
        margin-top: -88px;
    }
}

.empty-text {
    position: $relative;
    top: 20px;
    left: 20px;
}

.save-as-modal {
    .save-as-modal-name {
        width: 270px;
    }
    .save-as-modal-path {
        width: 300px;
        display: inline-block;
    }
}

// 工作区为空背景设置
.bg-page {
    width: 360px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;

    .bg-img {
        width: 162px;
        height: 145px;
        margin-bottom: 20px;

        @media screen and (max-height: 600px){
            display: none;
        }
    }
    .bg-text {
        width: 100%;
        text-align: left;
        &.weight {
            margin-top: 10px;
            font-weight: bold;
        }
        &.indent {
            text-indent: 2em;
        }
    }
}

/* 设置滚动条的样式 */
.we-result-view .ivu-table-body::-webkit-scrollbar {
    width: 8px;
}
/* 滚动槽 */
.we-result-view .ivu-table-body::-webkit-scrollbar-track {
    box-shadow: inset 0 0 2px $shadow-color;
    -webkit-box-shadow: inset 0 0 2px $shadow-color;
    border-radius: $border-radius-large;
    -webkit-border-radius: $border-radius-large;
    -moz-border-radius: $border-radius-large;
    -ms-border-radius: $border-radius-large;
    -o-border-radius: $border-radius-large;
}
/* 滚动条滑块 */
.we-result-view .ivu-table-body::-webkit-scrollbar-thumb {
    box-shadow: inset 0 0 2px $shadow-color;
    border-radius: $border-radius-large;
    background: $primary-color;
    -webkit-box-shadow: inset 0 0 2px $shadow-color;
    -webkit-border-radius: $border-radius-large;
    -moz-border-radius: $border-radius-large;
    -ms-border-radius: $border-radius-large;
    -o-border-radius: $border-radius-large;
}
.we-result-view .ivu-table-body::-webkit-scrollbar-thumb:window-inactive {
    background: $primary-color;
}

.not-allow-download{
    .ivu-poptip-popper.we-poptip.v-transfer-dom{
        display: none;
    }
}
